package cn.wolfcode.wms.domain;

import lombok.Getter;
import lombok.Setter;

import java.util.List;

@Getter@Setter
public class Employee {
    private Long id;

    private String name;

    private String password;

    private String email;

    private Integer age;

    private Boolean admin;

    private Department dept;

    private List<Role> roles;

    public String getRoleName(){
        if (this.admin){
            return "[超级管理员]";
        }
        StringBuilder sb = new StringBuilder(199);
        sb.append("[");
        List<Role> roles = this.getRoles();
        if (roles.size()==0){
            return "[屁民]";
        }
        for (Role role : roles){
            sb.append(role.getName()).append(",");
        }
        sb.deleteCharAt(sb.length()-1);
        sb.append("]");
        return sb.toString();
    }
}